package com.xlh.config;

import com.alibaba.csp.sentinel.adapter.servlet.CommonFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
//CommonFilter alibaba 2.1.1 才有这个类, 高版本配置方式发生了变化
//@Configuration
public class FilterContextConfig {
    @Bean
    public FilterRegistrationBean sentinelFilterRegistration(){
        FilterRegistrationBean registration = new FilterRegistrationBean();
       /* registration.setFilter(new CommonFilter());
        registration.addUrlPatterns("/*");
     // 入口资源关闭聚合
     registration.addInitParameter(CommonFilter.WEB_CONTEXT_UNIFY, "false");
     registration.setName("sentinelFilter");
     registration.setOrder(1);*/
      return registration;
    }
}
